package org.example.Demo01;

import com.oracle.xmlns.internal.webservices.jaxws_databinding.ExistingAnnotationsType;
import org.example.pojo.Brand;
import org.example.pojo.Menu;

import java.util.List;
import java.util.Scanner;

public class App {

    public static void main(String[] args) throws Exception {
        Menu menu = new Menu();
        menu.mainMenu();
        Scanner sc = new Scanner(System.in);
        int select = sc.nextInt();

        switch (select){
            case 1:
                //查询功能
                JDBC_Select jdbcSelect = new JDBC_Select();
                List<Brand> result = jdbcSelect.select();
                for (Brand brand : result) {
                    System.out.println(brand);
                }
                break;
            case 2:
                //更新操作
                JDBC_Update jdbcUpdate = new JDBC_Update();
                int res = jdbcUpdate.update();
                if (res != 1){
                    System.out.println("登录失败!!!!");
                }else {
                    System.out.println("登录成功!!!!");
                }
                break;
            case 3:
                //添加操作
                JDBC_Add jdbcAdd = new JDBC_Add();
                int count = jdbcAdd.insert();
                if (count != 0){
                    System.out.println("插入成功!!!");
                }else {
                    System.out.println("插入失败!!!");
                }
                break;
            case 4:
                //删除操作
                JDBC_Delete jdbcDelete = new JDBC_Delete();

                int delete = jdbcDelete.delete();
                if (delete != 0){
                    System.out.println("删除成功");
                }else {
                    System.out.println("删除失败");
                }
                break;
            default:
                System.exit(0);

        }








    }
}
